# Contributor: Taner Tas <taner76@gmail.com>
# Maintainer: Taner Tas <taner76@gmail.com>
pkgname=gst-vaapi
# NOTE: Upgrade only to even-numbered minor versions (e.g. 1.20.x, 1.22.x)!
#  Odd versions are unstable development releases.
pkgver=1.22.8
pkgrel=0
pkgdesc="GStreamer streaming media framework VA API plug-ins"
url="https://gstreamer.freedesktop.org/"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	eudev-dev
	glib-dev
	gst-plugins-bad-dev
	libva-dev
	libxrandr-dev
	meson
	"
options="!check" # Need actual display with HW accel
source="https://gstreamer.freedesktop.org/src/gstreamer-vaapi/gstreamer-vaapi-$pkgver.tar.xz"
builddir="$srcdir/gstreamer-vaapi-$pkgver"

# make name more consistent with gst-
provides="gstreamer-vaapi=$pkgver-r$pkgrel"
replaces="gstreamer-vaapi"

build() {
	CFLAGS="$CFLAGS -O2" \
	CXXFLAGS="$CXXFLAGS -O2" \
	CPPFLAGS="$CPPFLAGS -O2" \
	abuild-meson \
		-Db_lto=true \
		-Dtests="$(want_check && echo enabled || echo disabled)" \
		. output
	meson compile -C output
}

check() {
	meson test -C output --print-errorlogs
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
fe3b5fab50d53c74ba28252a6bad6b225277143b49f575ebc32eae0289ad9953cb79702251e3df2053e6c2ae4227a2cf0899326f4b16d51f7544581d4261eb43  gstreamer-vaapi-1.22.8.tar.xz
"
